using System;
using System.Collections.Generic;
using System.Text;

namespace Eve.Data
{
    public class TypeAttribute : EveAssociation<Type, Attribute>
    {
        private int valueInt;
        private double valueFloat;

        public Type Type
        {
            get { return From; }
        }
        public Attribute Attribute
        {
            get { return To; }
        }
        public int Integer
        {
            get { return valueInt; }
        }
        public double Float
        {
            get { return valueFloat; }
        }

        internal TypeAttribute(DbDataRow dr)
            : base(dr.Database, new Type(dr.Database, dr["typeID"]), new Attribute(dr.Database, dr["attributeID"]))
        {
            Fill(dr);
        }
        internal TypeAttribute(DbDataRow dr, Type type)
            : base(dr.Database, type, new Attribute(dr.Database, dr["attributeID"]))
        {
            Fill(dr);
        }

        private void Fill(DbDataRow dr)
        {
            valueInt = dr["valueInt"];
            valueFloat = dr["valueFloat"];
        }
    }
}
